# -*- coding: utf-8 -*-
"""
Module Description: url定义
"""
from framework.firefly_dc.globalobject import GlobalObject
from framework.router.forwarding import forwarding, save_head_logic

application = GlobalObject.webapp


@application.route('/healthcheck', methods=('GET', 'POST'))
def health_check():
    """健康检查"""
    return '{}'


@application.route('/save_head', methods=('GET', 'POST'))
def save_head():
    """保存头像"""
    return save_head_logic()


@application.route('/frontend', methods=('GET', 'POST'))
def frontend():
    """
    接收urlencode格式的参数
    """
    try:
        return forwarding()
    except Exception as e:
        # 增加日志
        # from utils import print_exc
        from utils.traceback_utils import print_exc
        print_exc(e)
        return '{}'


@application.route('/frontend_stateless', methods=('GET', 'POST'))
def frontend_stateless():
    """
    接收json格式的参数
    """
    try:
        return forwarding()
    except Exception as e:
        # 增加日志
        from utils.traceback_utils import print_exc
        print_exc(e)
        return '{}'
